import React from 'react';
import { Switch } from '@ray-js/smart-ui';

interface SmartSwitchProps {
  value: boolean;
  onChange: (value: boolean) => void;
  disabled?: boolean;
}

const SmartSwitch = ({ value, onChange, disabled = false }: SmartSwitchProps) => {
  const handleChange = (e: any) => {
    const nextValue = e.detail;
    onChange(nextValue);
  };

  return (
    <Switch
      style={{ width: '40px', height: '20px' }}
      size="24px"
      customClass="custom-smart-switch"
      nodeClass="custom-smart-switch-node"
      activeColor="#5195D0"
      disabled={disabled}
      checked={value}
      onChange={handleChange}
    />
  );
};

export default SmartSwitch;
